﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Mach;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Mach
{
    public class MachiningCreateCommandHandler : IRequestHandler<MachiningCreateCommand, int>
    {
        protected readonly IMachiningSerivce serivce;

        public MachiningCreateCommandHandler(IMachiningSerivce serivce)
        {
            this.serivce = serivce;
        }

        public async Task<int> Handle(MachiningCreateCommand request, CancellationToken cancellationToken)
        {
            return await serivce.MachUpd(new machiningInfo()
            {
                machiningInfoid = request.machiningInfoid,
                GoodsInfoid = request.GoodsInfoid,
                ClassGroup = request.ClassGroup,
                charge = request.charge,
                RawMaterials = request.RawMaterials,
                AuxiliaryMaterial = request.AuxiliaryMaterial,
                additive = request.additive,
                PackingMaterial = request.PackingMaterial,
            });
        }
    }
}
